import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppComponent} from './app.component';
import {AppMenuComponent} from "./app-menu/app-menu.component";
import {FallbackComponent} from "./fallback/fallback.component";
import {ShouldLoginComponent} from "./should-login.component";
import {CoreModule} from "./core/core.module";
import {AppRoutingModule} from "./app-routing.module";
import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http";
import {CorsInterceptor} from "./interceptors/cors.interceptor";
import {LoginComponent} from './login/login.component';
import {FormsModule} from "@angular/forms";
import {TestRequestInterceptor} from "./interceptors/test-request.interceptor";
import {CommonModule, registerLocaleData} from "@angular/common";
import {NgxPermissionsModule} from "ngx-permissions";
import {NZ_I18N, zh_CN} from 'ng-zorro-antd/i18n';
import zh from '@angular/common/locales/zh';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {SharedModule} from "./shared/shared.module";
import {RegisterComponent} from "./pages/register/register.component";
import {EditUserComponent} from './pages/edit-user/edit-user.component';

registerLocaleData(zh);

@NgModule({
  declarations: [
    AppComponent,
    AppMenuComponent,
    FallbackComponent,
    ShouldLoginComponent,
    LoginComponent,
    RegisterComponent,
    EditUserComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    CommonModule, // 引入 CommonModule 以使用 *ngIf
    // HttpClientModule,
    CoreModule.forRoot(),
    NgxPermissionsModule.forRoot({
      rolesIsolate: true,
      permissionsIsolate: true}),
    AppRoutingModule,
    HttpClientModule,
    BrowserAnimationsModule,
    SharedModule,

  ],
  providers: [
    // 注册HTTP拦截器
    {
      provide: HTTP_INTERCEPTORS,
      useClass: CorsInterceptor,
      multi: true
    },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: TestRequestInterceptor,
      multi: true
    },
    { provide: NZ_I18N, useValue: zh_CN },

  ],
  bootstrap: [AppComponent],

})
export class AppModule { }
